{extend name="base"/}
{block name="resources"}
{/block}
{block name="main"}

<!-- 筛选面板 -->
<div class="ns-single-filter-box">
    <div class="layui-form">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="start_time" id="start_time" placeholder="开始时间" class="layui-input" autocomplete="off" readonly>
                <i class="ns-calendar"></i>
            </div>
            <div class="layui-input-inline end-time">
                <input type="text" name="end_time" id="end_time" placeholder="结束时间" class="layui-input" autocomplete="off" readonly>
                <i class="ns-calendar"></i>
            </div>
            <button class="layui-btn layui-btn-primary" lay-submit lay-filter="search">搜索</button>
        </div>
    </div>
</div>

<div class="layui-card ns-card-common ns-card-brief">
    <div class="layui-card-header">
		<span class="ns-card-title">入驻费用记录</span>
    </div>
	<div class="layui-card-body">
		<table id="renewal_list" lay-filter="renewal_list"></table>
	</div>
</div>

{/block}
{block name="script"}
<script>
    // 到期时间
    var table, form, laytpl, laydate, repeat_flag = false;
    layui.use(['form', 'laytpl', 'laydate'], function() {
        form = layui.form;
        laytpl = layui.laytpl;
        laydate = layui.laydate;

		form.render();
        //开始时间
        laydate.render({
            elem: '#start_time' //指定元素
            ,done: function(value, date, endDate){
                start_time = ns.date_to_time(value);

            }
        });
        //结束时间
        laydate.render({
            elem: '#end_time' //指定元素
            ,done: function(value, date, endDate){
                end_time = ns.date_to_time(value);
            }
        });

        /**
         * 搜索功能
         */
        form.on('submit(search)', function (data) {
            data.field.start_time = start_time;
            data.field.end_time = end_time;
            table.reload({
                page: {
                    curr: 1
                },
                where: data.field
            });
            return false;
        });

        table = new Table({
            elem: '#renewal_list',
            url: ns.url("city://city/account/fee"),
            cols: [
                [{
                    field: 'account_no',
                    title: '账单编号',
                    unresize: 'false',
					width: '20%'
                }, {
                    field: 'site_name',
                    title: '店铺名称',
                    unresize: 'false',
					width: '15%'
                }, {
                    field: 'money',
                    title: '<span style="padding-right: 50px;">缴费金额（元）</span>',
                    unresize: 'false',
					align: 'right',
					width: '15%',
					templet: function(data) {
						return '<span style="padding-right: 50px;">'+ data.money +'</span>';
					},
                }, {
                    field: 'website_commission',
                    title: '<span style="padding-right: 50px;">站点分成（元）</span>',
                    unresize: 'false',
					align: 'right',
					width: '15%',
					templet: function(data) {
						return '<span style="padding-right: 50px;">'+ data.website_commission +'</span>';
					},
                }, {
                    field: 'type_name',
                    title: '费用类型',
                    unresize: 'false',
					width: '15%'
                }, {
                    field: 'create_time',
                    title: '创建时间',
                    unresize: 'false',
					width: '20%',
                    templet: function(data) {
                        if(data.create_time == 0){
                            return '--';
                        }else{
                            return ns.time_to_date(data.create_time)
                        }
                    },
                }]
            ]
        });

    });

    //申请续签
    $(".reopen_apply").click(function () {
        location.href = ns.url("city://city/cert/reopen");
    });
    //认证
    $(".shop_auth_apply").click(function () {
        location.href = ns.url("city://city/cert/index");
    });

    //编辑续签
    $(".reopen_apply_detail").click(function () {
        location.href = ns.url("city://city/cert/editreopeninfo");
    });

    //续签记录
    $(".reopen-list").click(function () {
        location.href = ns.url("city://city/account/reopenlist");
    });

</script>

{/block}
